import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code1 {
    static int count = 0;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = in.nextInt();
        int right = in.nextInt();
        for(int i=left;i<=right;i++) {
            panduan(i);
        }
        System.out.println(count);
    }
    public static void panduan(int x) {
        while(x!=0) {
            if(x%10==2) count++;
            x/=10;
        }
    }
}
